﻿using System;

namespace csharpbiancheng_ch11_example5
{
    //【委托】使用匿名委托计算长方形的面积。
    class Program
    {
        public delegate void AreaDelegate(double length, double width);
        static void Main(string[] args)
        {
            Console.WriteLine("请输入长方形的长：");
            double length = double.Parse(Console.ReadLine());
            Console.WriteLine("请输入长方形的宽：");
            double width = double.Parse(Console.ReadLine());
            AreaDelegate areaDelegate = delegate
            {
                Console.WriteLine("长方形的面积为：" + length * width);
            };
            areaDelegate(length, width);
        }
    }
}
